package com.example.keli.ui.userinfo;

import android.content.Context;
import android.widget.TextView;

import com.example.keli.R;
import com.example.keli.base.adapter.RecyclerAdapter;
import com.example.keli.base.adapter.RecyclerViewHolder;
import com.example.keli.ui.my.model.UserInfo;

import java.util.Arrays;
import java.util.List;

/**
 * description $desc$
 * created by jerry on 2019/3/18.
 */
public class UserInfoActiveAdapter extends RecyclerAdapter<UserInfo.ActivityListBean.DataBean> {

    protected final List<String> sStatus = Arrays.asList("待启动", "报名中","进行中","已结束");
    private Context mContext;

    public UserInfoActiveAdapter(Context context, int layoutId, List<UserInfo.ActivityListBean.DataBean> datas) {
        super(context, layoutId, datas);
        this.mContext = context;
    }

    @Override
    public void convert(RecyclerViewHolder hepler, UserInfo.ActivityListBean.DataBean dataBean) {
        TextView name = hepler.getView(R.id.tv_active_name);
        TextView status = hepler.getView(R.id.tv_active_status);


        name.setText(dataBean.getTitle());
        if (dataBean.getStatus() == 3){
            status.setTextColor(mContext.getResources().getColor(R.color.text_hint));
        }else {
            status.setTextColor(mContext.getResources().getColor(R.color.text_color));
        }
        status.setText(sStatus.get(dataBean.getStatus()-1));
    }
}
